package com.example.foo.member.dao;

import org.apache.commons.lang3.StringUtils;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.core.PageResult;
import com.example.core.Pageable;
import com.example.foo.member.model.AdressManage;
import com.example.foo.member.query.AdressManageQuery;

@org.apache.ibatis.annotations.Mapper
public interface AdressManageDao extends com.example.core.dao.BaseDao<AdressManage, Long> {

	public default PageResult<AdressManage> findAdressManages(AdressManageQuery adressManageQuery, Pageable pageable) {
		QueryWrapper<AdressManage> queryWrapper = createQueryWithBaseIf(adressManageQuery);
		//
		if (adressManageQuery.getUid() != null) {
			queryWrapper.eq("uid", adressManageQuery.getUid());
		}
		if (StringUtils.isNotBlank(adressManageQuery.getAreaCode())) {
			queryWrapper.eq("area_code", adressManageQuery.getAreaCode());
		}
		return findPages(queryWrapper, pageable);
	}

}
